package com.springboot.cms.kit;

/**
 * Created by Administrator on 2016/10/12.
 * id生成器
 */
public class IdWokerKit {
    private static IdGenerate idGenerate;
    static {
        idGenerate=new IdGenerate(0L,0L);
    }

    /**
     * 生成12位的订单号
     * @return
     */
    public static  long createOrderNumber(){
        String _id=getId();
        _id=_id.substring(_id.length()-12);
        return Long.parseLong(_id);
    }

    /**
     * 得到自增长 id 18位
     * @return
     */
    public static String getId(){
        return  String.valueOf(idGenerate.nextId());
    }

    public static void main(String[] args) {
        System.out.println(getId().length());
        for (int i = 0; i < 200; i++) {
            System.out.println(getId());
        }
    }
}
